# -*-  coding: UTF-8  -*-

import pickle

__CONFIG_FILE = "activities.pkl"

class MyConfig(object) :

    def __init__(self) :
        self.when     = ['10:00', '12:00', '15:00', '17:00']
        self.interval = 15

# Load the configuration
__Config = MyConfig()
try :
    f = open(__CONFIG_FILE, 'rb')
    __Config = pickle.load(f)
except (IOError, AttributeError) :
    pass

def SaveConfig() :
    pickle.dump(__Config, open(__CONFIG_FILE, 'wb'))

def GetInterval() :
    return __Config.interval

def GetWhen(w = None) :
    return __Config.when if w == None else __Config.when[w]

def SetInterval(i) :
    __Config.interval = i

def SetWhen(w, t) :
    __Config.when[w] = t
